package com.app.piemoment.entity;

import org.json.JSONException;
import org.json.JSONObject;

public class LoginInfo extends PackageCallback {
	private static LoginInfo instance = new LoginInfo();
	long puid;
	String access_token = "";
	String refresh_token = null;
	long expires_at;
	Object scope;

	public static LoginInfo getInstance() {
		return instance;
	}

	private LoginInfo() {
	}

	@Override
	public LoginInfo parseItem(JSONObject json) {
		access_token = null;
		refresh_token = null;
		try {
			if(json.has("puid")) {
				puid = json.getLong("puid");
			}
			if(json.has("access_token")) {
				access_token = json.getString("access_token");
			}
			if(json.has("refresh_token")){
				
				refresh_token = json.getString("refresh_token");
			}
			if (json.has("expires_at")) {
				expires_at = json.getLong("expires_at");
			}
			if (json.has("scope")) {
				scope = json.getLong("scope");
			}
		} catch (JSONException e) {

			e.printStackTrace();
		}

		return this;
	}

	public long getPuid() {
		return puid;
	}

	public void setPuid(long puid) {
		this.puid = puid;
	}

	public String getAccess_token() {
		return access_token;
	}

	public void setAccess_token(String accessToken) {
		access_token = accessToken;
	}

	public String getRefresh_token() {
		return refresh_token;
	}

	public void setRefresh_token(String refreshToken) {
		refresh_token = refreshToken;
	}

	public long getExpires_at() {
		return expires_at;
	}

	public void setExpires_at(long expiresAt) {
		expires_at = expiresAt;
	}

	public Object getScope() {
		return scope;
	}

	public void setScope(Object scope) {
		this.scope = scope;
	}

}
